SchoolUser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 24
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A getSchool 0 3 1
A getUser 0 3 1
A getId 0 3 1
1
import { Entity, PrimaryGeneratedColumn, ManyToOne } from 'typeorm';
2
import { School } from './School.entity';
3
import { User } from '../User/User.entity';
4
5
@Entity()
6
export class SchoolUser {
7
  @PrimaryGeneratedColumn('uuid')
8
  private id: string;
9
10
  @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' })
11
  private school: School;
12
13
  @ManyToOne(() => User, { nullable: false, onDelete: 'CASCADE' })
14
  private user: User;
15
16
  constructor(school: School, user: User) {
17
    this.school = school;
18
    this.user = user;
19
  }
20
21
  public getId(): string {
22
    return this.id;
23
  }
24
25
  public getSchool(): School {
26
    return this.school;
27
  }
28
29
  public getUser(): User {
30
    return this.user;
31
  }
32
}
33